<?php
/**
 * Created by lzl
 * Date: 2021 2021/11/16
 * Time: 15:18
 */
namespace App\Http\Controllers\Admin;


use App\Forms\PlatFormForms;

class PlatFormController extends Controller
{

    /**
     * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View|mixed
     * @throws \App\Exceptions\RequestException
     */
    public function index()
    {
        if($this->request->isMethod('post')) {

            $rules = [
                'pro_keywords'     => 'nullable',
                'pro_description'  => 'nullable',
                'pro_content'      => 'nullable',
                'shop_avatar'      => 'nullable',
                'shop_nick_name'   => 'nullable',
                'shop_mobile'      => 'nullable',
                'shop_wechat'      => 'nullable',
                'shop_wechat_code' => 'nullable',
                'operate'          => 'nullable',
            ];

            $this->validateInput($rules);

            return $this->success( (new PlatFormForms())->update($this->validated));
        }

        return $this->view('platform.index', ['model' => (new PlatFormForms())->get()]);
    }
}